﻿<Window x:Class="WPFXMPPClient.FileTransferWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        AllowsTransparency="True" WindowStyle="None"
        MouseDown="Window_MouseDown"  ResizeMode="CanResizeWithGrip" Loaded="Window_Loaded"
        Title="FileTransferWindow" Height="383" Width="387">

    <Window.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FFBBFF81" Offset="0"/>
            <GradientStop Color="#FFEEFFDF" Offset="1"/>
        </LinearGradientBrush>
    </Window.Background>


    <Border BorderBrush="Black" BorderThickness="1" CornerRadius="2" >

        <Grid x:Name="LayoutRoot" Background="Transparent">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>

            <Border Grid.Row="0"  BorderThickness="1">
                <Border.BorderBrush >
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="Black" Offset="0"/>
                        <GradientStop Color="Gray" Offset="1"/>
                    </LinearGradientBrush>
                </Border.BorderBrush>
            </Border>

            <Grid Margin="0,5" Grid.Row="0" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="357*" />
                    <ColumnDefinition Width="40" />
                    <ColumnDefinition Width="40" />
                </Grid.ColumnDefinitions>
                <TextBlock Margin="10,0" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20" FontWeight="Bold"> File Transfers</TextBlock>
                <Button Style="{StaticResource ButtonSurface}" ToolTip="Clear Transfers" Grid.Column="1" x:Name="ButtonClearTransfers" Click="ButtonClearTransfers_Click"  Height="40"  Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" >
                    <Image Source="Images/trash.png" Width="30" Height="20" VerticalAlignment="Center" Margin="0" />
                </Button>
                <Button Style="{StaticResource ButtonSurface}" ToolTip="Close" Grid.Column="2" x:Name="ButtonClose" Click="ButtonClose_Click"  Height="40"  Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" >
                    <Image Source="Images/calculator - multiply.png" Width="30" Height="20" VerticalAlignment="Center" Margin="0" />
                </Button>
            </Grid>

            <ListBox SelectionMode="Multiple" Grid.Row="1" Margin="3,0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
                 DataContext="{Binding Conversation}" Background="Beige" x:Name="ListBoxConversation">
                <ListBox.ItemTemplate>
                    <DataTemplate>

                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="70" />
                                <ColumnDefinition Width="400*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <Image Grid.RowSpan="1" Grid.Column="0" Grid.Row="0" Width="32" Height="32" Source="Images/File.png" />

                            <TextBlock Grid.Column="1" Grid.Row="0"  Text="{Binding StringValue}" FontSize="12" TextWrapping="Wrap" />
                            <ProgressBar Grid.Column="1" Grid.Row="1" Height="20"  Value="{Binding PercentTransferred}" Maximum="100" />

                            <!--Accept or Cancel, only visible for incoming request-->
                            <StackPanel Grid.Column="1" Visibility="{Binding IsVisibleSendCancel, Mode=OneWay}" Grid.Row="2"  Orientation="Horizontal">
                                <Button Style="{StaticResource ButtonSurface}" x:Name="ButtonCancelSend" Click="ButtonCancelSend_Click">Cancel</Button>
                            </StackPanel>
                            <StackPanel Grid.Column="1" Grid.Row="2"  Orientation="Horizontal">
                                <Button Style="{StaticResource ButtonSurface}" Margin="5,0" Visibility="{Binding IsAcceptCancelVisible, Mode=OneWay}" x:Name="ButtonAcceptTransfer" Click="ButtonAcceptTransfer_Click">Accept</Button>
                                <Button Style="{StaticResource ButtonSurface}" Margin="5,0" Visibility="{Binding IsAcceptCancelVisible, Mode=OneWay}" x:Name="ButtonDeclineTransfer" Click="ButtonDeclineTransfer_Click">Decline</Button>
                                <!--<Button Margin="5,0" Visibility="{Binding IsSaveVisible, Mode=OneWay}" x:Name="ButtonSaveFile" Click="ButtonSaveFile_Click" Content="Save" />-->
                                <Button Style="{StaticResource ButtonSurface}" Margin="5,0" Visibility="{Binding IsSaveVisible, Mode=OneWay}" x:Name="ButtonOpenFile" Click="ButtonOpenFile_Click"  Content="Open" />
                            </StackPanel>

                        </Grid>

                    </DataTemplate>
                </ListBox.ItemTemplate>

            </ListBox>

           

        </Grid>

    </Border>
    
</Window>
